<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<script language="javascript">
	showLabel("buscar")
	var aryOptions = new Array();
	var optionSize = 0;
	var loaded = false;
	
	function init(){
		if(!loaded){
			optionSize = document.informacionForm.idenSubtipo.length;
			for(i=0;i<optionSize;i++){
				aryOptions[i] = document.informacionForm.idenSubtipo.options[i];
			}
			loaded = true;
		}
	}
	
	function selectSubtipos(selTipo){
		document.informacionForm.idenSubtipo.length = 0;
		for(i=0;i<optionSize;i++){
			tipo = aryOptions[i].value.split("|")[0];
			subtipo = aryOptions[i].value.split("|")[1];
			texto = aryOptions[i].text;
			if(tipo == selTipo || tipo == 0){
				document.informacionForm.idenSubtipo[document.informacionForm.idenSubtipo.length] = new Option(texto,subtipo);
			}			
		}
	}
	
	function showTip(text){
		document.getElementById('st').innerHTML = "";
		if(text.length > 50){
			document.getElementById('st').innerHTML=text;
		}
	}
	
</script>
<table border="0" cellpadding="5" cellspacing="0" height="100%" style="font-family:arial;font-size:8pt" width="100%">
<tr>
	<td valign="top">
		<html:errors/>
		<html:form action="/adm/listarPublicaciones.do">
		<p align="center">
			<html:submit value="Buscar" style="height:18pt;width:25%;background-color:rgb(204, 204, 204);color:rgb(0, 0, 0);font-family: arial; font-size: 9pt;font-weight:normal"/>
			<html:reset value="Borrar" style="height:18pt;width:25%;background-color:rgb(204, 204, 204);color:rgb(0, 0, 0);font-family: arial; font-size: 9pt;font-weight:normal"/>
		</p>
			<table border="1" cellpadding="5" cellspacing="0" width="100%" style="font-family:arial;font-size:8pt">
				<tr>
					<th align="right" style="background-color:#3399ca;color:#ffffff;border-style:none">
						Tipo:
					</th>
					<td valign="top">
						<html:select style="border:1px solid #cccccc" property="identipo" onchange="init();selectSubtipos(this.value)">
							<option value="0" selected>Seleccione un Tipo</option>
							<logic:iterate id="tipo" name="tipos" scope="request" type="org.fiel.domain.Tipo">
								<option value="<bean:write name="tipo" property="identipo"/>"><bean:write name="tipo" property="descripcion"/></option>
							</logic:iterate>
						</html:select>
					</td>
				</tr>
				<tr>
					<th align="right" style="background-color:#3399ca;color:#ffffff;border-style:none">
						Subtipo:
					</th>
					<td valign="top">
						<html:select style="border:1px solid #cccccc;width:410px" property="idenSubtipo" onchange="showTip(document.informacionForm.idenSubtipo[document.informacionForm.idenSubtipo.selectedIndex].text)">
							<option value="0|0" selected>Seleccione un Subtipo</option>
							<logic:iterate id="subtipo" name="subtipos" scope="request" type="org.fiel.domain.Subtipo">
								<option value="<bean:write name="subtipo" property="identipo"/>|<bean:write name="subtipo" property="idensubtipo"/>"><bean:write name="subtipo" property="descripcion"/> - <bean:write name="subtipo" property="desSubtipo"/></option>
							</logic:iterate>
						</html:select>
						<br>
						<span id="st" style="font-family:arial;font-size:8pt"></span>
					</td>
				</tr>
			</table>
		</html:form>
	</td>
</tr>
</table>
